﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class admin_Login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            string adminUid = TextBox1.Text;//用户名
            string adminPwd = Md5.getMd5(TextBox2.Text);//密码
            DbAccess db = new DbAccess();
            string sql = "select uid,password from administrator where uid='" + adminUid + "' and password='" + adminPwd + "'";
            DataSet ds = db.GetDataSet(sql);
            if (ds.Tables[0].Rows.Count > 0)
            {
                Session["admin"] = adminUid;
                Response.Redirect("main.aspx");
            }
            else
                Response.Redirect("Login.aspx");
        }
        catch
        { 
        
        }
    }
}
